#include <Library/BaseMemoryLib.h>
#include <Protocol/GraphicsOutput.h>

#include "File.h"
#include "Tools.h"

#pragma pack(1)
enum PixelFormat {
  kPixelRGBResv8BitPerColor,
  kPixelBGRResv8BitPerColor,
};
typedef struct
{
    // EFI_PHYSICAL_ADDRESS       FrameBufferBase;
    // UINTN                      FrameBufferSize;
    // UINT32                     HorizontalResolution;
    // UINT32                     VerticalResolution;
    // UINT32                     PixelsPerScanLine;
  uint8_t *frame_buffer;
  uint32_t pixels_per_scan_line;
  uint32_t horizontal_resolution;
  uint32_t vertical_resolution;
  enum PixelFormat pixel_format;
} FrameBufferConfig // @Video.h

typedef struct
{
    UINTN Size;
    UINTN PageSize;
    UINTN Width;
    UINTN Height;
    UINTN Offset;
    UINT64 PixelStart;
    UINT64 BitsPerPx;
} BMP_CONFIG;
#pragma pack(1)
EFI_STATUS GetGopHandle(
    IN EFI_HANDLE ImageHandle,
    EFI_GRAPHICS_OUTPUT_PROTOCOL **Gop
);

EFI_STATUS SetVideoMode(
    IN EFI_GRAPHICS_OUTPUT_PROTOCOL *Gop
);

EFI_STATUS BmpTransform(
    IN EFI_PHYSICAL_ADDRESS BmpBase,
    OUT BMP_CONFIG *BmpConfig
);

EFI_STATUS DrawBmp(
    IN EFI_GRAPHICS_OUTPUT_PROTOCOL *Gop,
    IN BMP_CONFIG BmpConfig,
    IN UINTN X,
    IN UINTN Y
);